//------------------------------------------------------------------------------
//	file cc_string.c
//	brief
//		Continuous controller (CC) string library (implementation file)
//		Converts a CC ID into a descriptive string
//
//	$Id: cc_string.c 3 2014-04-19 07:10:51Z ac.verbeck@gmail.com $
//------------------------------------------------------------------------------

//------------------------------------------------------------------------------
//	Copyright and Disclaimer Notice
//
//	The MIT License (MIT)
//	
//	Copyright (c) 2014 A.C. Verbeck
//	
//	Permission is hereby granted, free of charge, to any person obtaining a copy
//	of this software and associated documentation files (the "Software"), to deal
//	in the Software without restriction, including without limitation the rights
//	to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//	copies of the Software, and to permit persons to whom the Software is
//	furnished to do so, subject to the following conditions:
//	
//	The above copyright notice and this permission notice shall be included in
//	all copies or substantial portions of the Software.
//	
//	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//	IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//	FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//	AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//	LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//	OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
//	THE SOFTWARE.
//
//------------------------------------------------------------------------------

#include <stdint.h>																//	Standard int types
#include <stdbool.h>															//	Bool

#include "cc_string.h"

static CC_STRINGS cc_str[] = {
	{ 0, "Bank Select (MSB)"		},
	{ 1, "Modulation Wheel (MSB)"	},
	{ 2, "Breath Controller (MSB)"	},
	{ 4, "Foot Controller (MSB)"	},
	{ 5, "Portamento Time (MSB)"	},
	{ 6, "Data Entry (MSB)"			},
	{ 7, "Channel	Volume (MSB)"	},
	{ 8, "Balance (MSB)"			},
	{ 10, "Pan (MSB)"				},
	{ 11, "Expression (MSB)"		},
	{ 12, "Effect Control 1 (MSB)"	},
	{ 13, "Effect Control 2 (MSB)"	},
	{ 16, "General Purpose Controller 1 (MSB)"	},
	{ 17, "General Purpose Controller 2 (MSB)"	},
	{ 18, "General Purpose Controller 3 (MSB)"	},
	{ 19, "General Purpose Controller 4 (MSB)"	},

	{ 32, "Bank Select (LSB)"		},
	{ 33, "Modulation Wheel (LSB)"	},
	{ 34, "Breath Controller (LSB)"	},
	{ 36, "Foot Controller (LSB)"	},
	{ 37, "Portamento Time (LSB)"	},
	{ 38, "Data Entry (LSB)"		},
	{ 39, "Channel Volume	(LSB)"	},
	{ 40, "Balance (LSB)"			},
	{ 42, "Pan (LSB)"				},
	{ 43, "Expression (LSB)"		},
	{ 44, "Effect Control 1 (LSB)"	},
	{ 45, "Effect Control 2 (LSB)"	},
	{ 48, "General Purpose Controller 1 (LSB)"	},
	{ 49, "General Purpose Controller 2 (LSB)"	},
	{ 50, "General Purpose Controller 3 (LSB)"	},
	{ 51, "General Purpose Controller 4 (LSB)"	},

	{ 64, "Sustain Pedal"			},
	{ 65, "Portamento On/Off"		},
	{ 66, "Sostenuto"				},
	{ 67, "Soft Pedal"				},
	{ 68, "Legato Footswitch"		},
	{ 69, "Hold 2"					},
	{ 70, "Sound Controller 1"		},
	{ 71, "Sound Controller 2"		},
	{ 72, "Sound Controller 3"		},
	{ 73, "Sound Controller 4"		},
	{ 74, "Sound Controller 5"		},
	{ 75, "Sound Controller 6"		},
	{ 76, "Sound Controller 7"		},
	{ 77, "Sound Controller 8"		},
	{ 78, "Sound Controller 9"		},
	{ 79, "Sound Controller 10 (GM2 default: Undefined)"		},
	{ 80, "General Purpose Controller 5"						},
	{ 81, "General Purpose Controller 6"						},
	{ 82, "General Purpose Controller 7"						},
	{ 83, "General Purpose Controller 8"						},
	{ 84, "Portamento Control"									},
	{ 91, "Effects 1 Depth (default: Reverb Send)"				},
	{ 92, "Effects 2 Depth (default: Tremolo Depth)"			},
	{ 93, "Effects 3 Depth (default: Chorus Send)"				},
	{ 94, "Effects 4 Depth (default: Celeste [Detune] Depth)"	},
	{ 95, "Effects 5 Depth (default: Phaser Depth)"				},
	{ 96, "Data Increment"							},
	{ 97, "Data Decrement"							},
	{ 98, "Non-Registered Parameter Number (LSB)"	},
	{ 99, "Non-Registered Parameter Number(MSB)"	},
	{ 100, "Registered Parameter Number (LSB)"		},
	{ 101, "Registered Parameter Number(MSB)"		},
	{ 120, "All Sound Off"							},

	{ 121, "Reset All Controllers"		},
	{ 122, "Local Control On/Off"		},
	{ 123, "All Notes Off"				},
	{ 124, "Omni Mode Off (Poly off)"	},
	{ 125, "Omni Mode On (Mono off)"	},
	{ 126, "Poly Mode Off"				},
	{ 127, "Poly Mode On"				}
};
#define	CC_STRING_CT	(sizeof(cc_str)/sizeof(CC_STRINGS))

char*	getCCString(uint16_t id)
{
	uint16_t	idx=0;
	char*		rStr = "Undefined";

	for (idx=0; idx<CC_STRING_CT; idx++) {
		if (cc_str[idx].id == id) {
			rStr = cc_str[idx].str;
			break;
		}
	}
	return rStr;
}

//
//	End: cc_string.c
//
